$(function () {
    if (!$('body').hasClass('cm-menu-toggled')) {
        // 修复侧边栏点击位置偏移
        let $open = $('.cm-menu-items>li.open');
        let $open_box = $open.children('ul');
        let $open_box_li = $open_box.children('li');
        if (undefined != $open_box_li && $open_box_li.length > 0) {
            let translateY = 0;
            if ($open_box_li.length == 1) {
                translateY = 38;
            } else {
                translateY = $open_box_li.length * 39 - 1;
            }
            let $open_siblings_li = $open.parent().children();// .open元素的父元素的所有子元素
            for (let i = $open.index() + 1; i < $open_siblings_li.length; i++) {// 给当前展开的元素以后的所有元素加偏移
                $open_siblings_li.eq(i).css('transform', 'translateY(' + translateY + 'px)');
            }
        }
    } else {
        let $opens = $('.cm-menu-items>li');
        $opens.removeClass('open');
    }
});